package com.bookmarket.controller;

import com.bookmarket.service.LQBackIndexService;
import org.apache.ibatis.binding.BindingException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@RestController
@RequestMapping("/backIndex")
public class LQBackIndexController {

    @Resource
    private LQBackIndexService backIndexService;

    @RequestMapping("/toIndex")//跳转至首页
    public ModelAndView toIndex(){
        ModelAndView mv = new ModelAndView("backstage/index_v1");
        mv.addObject("customNum",backIndexService.customNum());
        return mv;
    }

    @RequestMapping("/getMonthSal")
    public int getMonthSal(int month){
        return backIndexService.oneMonthSal(month);
    }

    @RequestMapping("/getYearSal")
    public int getYearSal(int year){
        return backIndexService.oneYearSal(year);
    }

    public void setBackIndexService(LQBackIndexService backIndexService) {
        this.backIndexService = backIndexService;
    }


}
